/*
 * ControlCalidad.java
 *
 * Created on 29 de noviembre de 2008, 11:12
 */
package IU;

import Controladores.ControlPedido;
import Controladores.CtrlAMBOperario;
import Controladores.exceptions.NonexistentEntityException;
import Entidades.Ciu;
import Entidades.Condicion;
import Entidades.Detallerecepcion;
import Entidades.Estadoespera;
import Entidades.Operario;
import Entidades.Producto;
//import Entit.Persona;
import Expertos.ExpertoPedido;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import logica.jpaControllers.EstadoesperaJpaController;
import utiles.Validador;

/**
 *
 * @author  Analiaa
 */
public class ControlCalidad extends javax.swing.JFrame {

    Detallerecepcion detSeleccionado = new Detallerecepcion();
    private String botryt = "0";
    private String peronospora = "0";
    private String oidi = "0";
    private String graniz = "0";
    private static String operario;
    CtrlAMBOperario  coperar = new CtrlAMBOperario();
    Operario operar= new Operario();
    String operarioactivo="" ;
    /** Creates new form ControlCalidad */
    public ControlCalidad(String operario) {
        initComponents();
operarioactivo = operario;
        jTextFieldUsuario.setText(operarioactivo);
        jTextField1.setText(EsperaCalidad.variedad);
        patente.setText(EsperaCalidad.patente);
        clasificacion.setText(EsperaCalidad.clasificacion);
        peronospera.setEnabled(false);
        botrytis.setEnabled(false);
        oidio.setEnabled(false);
        granizo.setEnabled(false);
        try {
            operar = coperar.buscarOperarioApellido(operario);
        } catch (Exception ex) {
            Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    ControlCalidad(Detallerecepcion detalle, String operario) {
        initComponents();
        jTextFieldUsuario.setText(operario);
        jTextField1.setText(detalle.getProducto().getNombreProducto());
        patente.setText(detalle.getRecepcion().getTransporte().getPatenteTransporte());
        clasificacion.setText(detalle.getProducto().getClasificacionproducto().getNombreclasificacion());
        numeroRemito.setText(detalle.getRecepcion().getRemito().getNumeroRemito());
        numeroRecepcion.setText(detalle.getRecepcion().getNumeroRecepcion().toString());
        numeroContrato.setText(detalle.getRecepcion().getContrato().getNumeroContrato().toString());
        peronospera.setEnabled(false);
        botrytis.setEnabled(false);
        oidio.setEnabled(false);
        granizo.setEnabled(false);
        detSeleccionado = detalle;
        try {
            operar = coperar.buscarOperarioApellido(operario);
        } catch (Exception ex) {
            Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        buttonGroup4 = new javax.swing.ButtonGroup();
        jLabel4 = new javax.swing.JLabel();
        label1 = new java.awt.Label();
        label2 = new java.awt.Label();
        jSeparator1 = new javax.swing.JSeparator();
        label3 = new java.awt.Label();
        limpieza = new javax.swing.JComboBox();
        label5 = new java.awt.Label();
        temperatura = new javax.swing.JComboBox();
        label6 = new java.awt.Label();
        tenorA = new javax.swing.JTextField();
        label7 = new java.awt.Label();
        label12 = new java.awt.Label();
        label22 = new java.awt.Label();
        jScrollPane2 = new javax.swing.JScrollPane();
        observaciones = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        label8 = new java.awt.Label();
        label9 = new java.awt.Label();
        label10 = new java.awt.Label();
        label11 = new java.awt.Label();
        peronospera = new javax.swing.JTextField();
        oidio = new javax.swing.JTextField();
        botrytis = new javax.swing.JTextField();
        granizo = new javax.swing.JTextField();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton5 = new javax.swing.JRadioButton();
        jRadioButton6 = new javax.swing.JRadioButton();
        jRadioButton7 = new javax.swing.JRadioButton();
        jRadioButton8 = new javax.swing.JRadioButton();
        presenciaHojas = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        label19 = new java.awt.Label();
        label20 = new java.awt.Label();
        label21 = new java.awt.Label();
        bruto = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        varietal = new javax.swing.JTextField();
        noVarietal = new javax.swing.JTextField();
        pesoMedio = new javax.swing.JTextField();
        neto = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        graduac = new javax.swing.JTextField();
        racimosSegunda = new javax.swing.JComboBox();
        jTextField1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        patente = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        clasificacion = new javax.swing.JTextField();
        jSeparator3 = new javax.swing.JSeparator();
        jTextField2 = new javax.swing.JTextField();
        jTextFieldUsuario = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        numeroContrato = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jLabel9 = new javax.swing.JLabel();
        numeroRemito = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        numeroRecepcion = new javax.swing.JTextField();

        jLabel4.setText("jLabel4");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("CIU");

        label1.setFont(new java.awt.Font("Segoe UI", 3, 24));
        label1.setForeground(new java.awt.Color(102, 0, 102));
        label1.setText("Control de Calidad - CIU");

        label2.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label2.setText("Variedad Uva:");

        label3.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label3.setText("Limpieza:");

        limpieza.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Excelente", "Muy Bueno", "Bueno", "Regular", "Malo" }));
        limpieza.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        label5.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label5.setText("Temperatura:");

        temperatura.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Aceptable", "Regular", "Mala" }));
        temperatura.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        temperatura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                temperaturaActionPerformed(evt);
            }
        });

        label6.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label6.setText("Tenor Azucarino:");

        tenorA.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        label7.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label7.setText("Presencia de Hojas:");

        label12.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label12.setText("Racimos 2º Flor:");

        label22.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label22.setText("Observaciones:");

        observaciones.setColumns(20);
        observaciones.setRows(5);
        observaciones.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jScrollPane2.setViewportView(observaciones);

        jButton1.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton1.setForeground(new java.awt.Color(102, 0, 102));
        jButton1.setText("Rechazar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton2.setForeground(new java.awt.Color(102, 0, 102));
        jButton2.setText("Aceptar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), "Materiales Extraños", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 12), new java.awt.Color(102, 0, 102))); // NOI18N

        label8.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label8.setText("Peronóspera:");

        label9.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label9.setText("Oídio:");

        label10.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label10.setText("Botrytis:");

        label11.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label11.setText("Granizo:");

        peronospera.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        oidio.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        botrytis.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        granizo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton2.setText("Si");
        jRadioButton2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton2ActionPerformed(evt);
            }
        });

        buttonGroup2.add(jRadioButton4);
        jRadioButton4.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton4.setText("Si");
        jRadioButton4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton4ActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton1.setText("No");
        jRadioButton1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton1ActionPerformed(evt);
            }
        });

        buttonGroup2.add(jRadioButton3);
        jRadioButton3.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton3.setText("No");
        jRadioButton3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton3ActionPerformed(evt);
            }
        });

        buttonGroup3.add(jRadioButton5);
        jRadioButton5.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton5.setText("No");
        jRadioButton5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton5ActionPerformed(evt);
            }
        });

        buttonGroup3.add(jRadioButton6);
        jRadioButton6.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton6.setText("Si");
        jRadioButton6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton6ActionPerformed(evt);
            }
        });

        buttonGroup4.add(jRadioButton7);
        jRadioButton7.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton7.setText("No");
        jRadioButton7.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton7ActionPerformed(evt);
            }
        });

        buttonGroup4.add(jRadioButton8);
        jRadioButton8.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jRadioButton8.setText("Si");
        jRadioButton8.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        jRadioButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButton8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(label9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jRadioButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jRadioButton2))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jRadioButton3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jRadioButton4)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(peronospera, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
                    .addComponent(oidio))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(label11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jRadioButton5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jRadioButton6))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jRadioButton7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jRadioButton8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(botrytis)
                    .addComponent(granizo, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE))
                .addContainerGap(141, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(peronospera, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jRadioButton2)
                                .addComponent(jRadioButton1))
                            .addComponent(label8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(label9, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(oidio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jRadioButton4)
                                .addComponent(jRadioButton3))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(label10, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jRadioButton5)
                                .addComponent(jRadioButton6)
                                .addComponent(botrytis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(label11, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jRadioButton7)
                                .addComponent(jRadioButton8)
                                .addComponent(granizo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        label10.getAccessibleContext().setAccessibleName("Botr");

        presenciaHojas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mucho", "Poco", "Nada" }));
        presenciaHojas.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED), " Racimos de Prueba", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 3, 12), new java.awt.Color(102, 0, 102))); // NOI18N
        jPanel2.setFont(new java.awt.Font("Segoe UI", 3, 12));

        label19.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label19.setText("Bruto:");

        label20.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label20.setText("Neto:");

        label21.setFont(new java.awt.Font("Segoe UI", 3, 12));
        label21.setText("Peso Medio:");

        bruto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel3.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel3.setText("Cantidad No Varietal:");

        jLabel5.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel5.setText("Cantidad Varietal:");

        varietal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        noVarietal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        pesoMedio.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        neto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel8.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel8.setText("Graduacion:");

        graduac.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(label19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(label20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(label21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(20, 20, 20)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(pesoMedio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                    .addComponent(bruto, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE)
                    .addComponent(neto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 178, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel3)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(graduac, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
                    .addComponent(varietal, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
                    .addComponent(noVarietal, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(noVarietal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(neto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(varietal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(bruto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(26, 26, 26)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(label19, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(label20, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label21, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(pesoMedio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel8)
                        .addComponent(graduac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        racimosSegunda.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "5", "10", "15", "20" }));
        racimosSegunda.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextField1.setEditable(false);
        jTextField1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel1.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel1.setText("Patente:");

        patente.setEditable(false);
        patente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel2.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel2.setText("Clasificación:");

        clasificacion.setEditable(false);
        clasificacion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTextField2.setEditable(false);
        jTextField2.setText("%");

        jTextFieldUsuario.setEditable(false);
        jTextFieldUsuario.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jLabel6.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel6.setForeground(new java.awt.Color(102, 0, 102));
        jLabel6.setText("Usuario Registrado:");

        jLabel7.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel7.setText("N° Contrato:");

        numeroContrato.setEditable(false);
        numeroContrato.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jButton3.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jButton3.setForeground(new java.awt.Color(102, 0, 102));
        jButton3.setText("Salir");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel9.setText("N° Remito:");

        numeroRemito.setEditable(false);
        numeroRemito.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        numeroRemito.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numeroRemitoActionPerformed(evt);
            }
        });

        jLabel10.setFont(new java.awt.Font("Segoe UI", 3, 12));
        jLabel10.setText("N° Recepción:");

        numeroRecepcion.setEditable(false);
        numeroRecepcion.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        numeroRecepcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numeroRecepcionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(label12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(racimosSegunda, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(tenorA, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)
                                    .addComponent(limpieza, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(33, 33, 33)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(temperatura, 0, 239, Short.MAX_VALUE)
                                    .addComponent(presenciaHojas, 0, 239, Short.MAX_VALUE)))
                            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(29, 29, 29)
                                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel1)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(patente, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel7)))
                                .addGap(6, 6, 6)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(numeroContrato, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel9)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(numeroRemito, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel10)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(numeroRecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(clasificacion)))
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(label22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(109, 109, 109)
                                .addComponent(jLabel6)
                                .addGap(36, 36, 36)
                                .addComponent(jTextFieldUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE)
                                .addGap(10, 10, 10))))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(147, 147, 147)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextFieldUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(patente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(numeroContrato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(numeroRemito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(numeroRecepcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(clasificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(16, 16, 16))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(limpieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(temperatura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(tenorA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(presenciaHojas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(label7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(label12, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(racimosSegunda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(label22, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(jButton1)
                    .addComponent(jButton3))
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(112, 112, 112)
                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(443, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void temperaturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_temperaturaActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_temperaturaActionPerformed

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
// TODO add your handling code here:
    if (jRadioButton1.isSelected()) {
        peronospera.setEnabled(false);

    }
}//GEN-LAST:event_jRadioButton1ActionPerformed

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
// TODO add your handling code here:
    if (jRadioButton2.isSelected()) {
        peronospera.setEnabled(true);

    }
}//GEN-LAST:event_jRadioButton2ActionPerformed

private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed
// TODO add your handling code here:
    if (jRadioButton3.isSelected()) {
        oidio.setEnabled(false);

    }
}//GEN-LAST:event_jRadioButton3ActionPerformed

private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton4ActionPerformed
// TODO add your handling code here:
    if (jRadioButton4.isSelected()) {
        oidio.setEnabled(true);

    }
}//GEN-LAST:event_jRadioButton4ActionPerformed

private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton5ActionPerformed
// TODO add your handling code here:
    if (jRadioButton5.isSelected()) {
        botrytis.setEnabled(false);

    }
}//GEN-LAST:event_jRadioButton5ActionPerformed

private void jRadioButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton6ActionPerformed
// TODO add your handling code here:
    if (jRadioButton6.isSelected()) {
        botrytis.setEnabled(true);

    }
}//GEN-LAST:event_jRadioButton6ActionPerformed

private void jRadioButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton7ActionPerformed
// TODO add your handling code here:
    if (jRadioButton7.isSelected()) {
        granizo.setEnabled(false);

    }
}//GEN-LAST:event_jRadioButton7ActionPerformed

private void jRadioButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton8ActionPerformed
// TODO add your handling code here:
    if (jRadioButton8.isSelected()) {
        granizo.setEnabled(true);

    }
}//GEN-LAST:event_jRadioButton8ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    EstadoesperaJpaController estadoEsperaJpa = new EstadoesperaJpaController();
    Estadoespera ee = estadoEsperaJpa.findEstadoespera_x_nombre("Finalizado");
    detSeleccionado.setEstadoespera(ee);
    EsperaCalidad e = null;
        try {
            e = new EsperaCalidad(operar.getApellido());
        } catch (Exception ex) {
            Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
        }
    e.setLocationRelativeTo(null);
    e.setVisible(true);
   // dispose();
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
//        GestionCalidadCorrecta princi = new GestionCalidadCorrecta();
//        princi.setLocationRelativeTo(null);
//        princi.setVisible(true);
//        hide();

        Condicion c = new Condicion();
        Ciu ciu = new Ciu();
        ExpertoPedido ep = new ExpertoPedido();

        String azucar = tenorA.getText();
        String netoRTomados = neto.getText();
        String brutoRTomados = bruto.getText();
        String pesoMRacimos = pesoMedio.getText();
        peronospora = peronospera.getText();
        botryt = botrytis.getText();
        oidi = oidio.getText();
        graniz = granizo.getText();
        String totalRacimosV = varietal.getText();
        String grad = graduac.getText();
        String totalRacimosNV = noVarietal.getText();
        if (Float.parseFloat(brutoRTomados) < Float.parseFloat(netoRTomados)) {
            JOptionPane.showMessageDialog(this, "Verifique Peso bruto es menor al peso neto", "Error", JOptionPane.ERROR_MESSAGE);

        } else {
            if (validarDatos(azucar, netoRTomados, brutoRTomados, pesoMRacimos, peronospora, botryt, oidi, graniz, totalRacimosV, totalRacimosNV, grad)) {

                // racimosTomados.setText(Float.toString((netoR + brutoR)));
                c.setObservaciones(observaciones.getText());
                c.setLimpieza(limpieza.getSelectedItem().toString());
                c.setTemperatura(temperatura.getSelectedItem().toString());
                c.setPresenciaHojas(presenciaHojas.getSelectedItem().toString());
                c.setProducto(detSeleccionado.getProducto());
                if (jRadioButton2.isSelected()) {
                    c.setPeronospora(Float.parseFloat(peronospora));
                } else if (jRadioButton1.isSelected()) {
                    float peronos = 0;
                    c.setPeronospora(peronos);
                }

                if (jRadioButton6.isSelected()) {
                    c.setBotrytis(Float.parseFloat(botryt));
                } else if (jRadioButton5.isSelected()) {
                    float botr = 0;
                    c.setBotrytis(botr);
                }
                if (jRadioButton4.isSelected()) {
                    c.setOidio(Float.parseFloat(oidi));
                } else if (jRadioButton3.isSelected()) {
                    float oid = 0;
                    c.setOidio(oid);
                }
                if (jRadioButton8.isSelected()) {
                    c.setGranizo(Float.parseFloat(graniz));
                } else if (jRadioButton7.isSelected()) {
                    float grani = 0;
                    c.setGranizo(grani);
                }
                List<Producto> prod = new ArrayList<Producto>();
                ControlPedido e = new ControlPedido();
//        prod = e.buscarProductos(EsperaCalidad.variedad, EsperaCalidad.clasificacion);
//        Producto p = null;
//        for (Iterator<Producto> it = prod.iterator(); it.hasNext();) {
//        Producto producto = it.next();


                //if (p.getNombreProducto().equalsIgnoreCase(EsperaCalidad.variedad) & p.getClasificacionproducto().getNombreclasificacion().equalsIgnoreCase(EsperaCalidad.clasificacion)) {
//                c.setIdProducto(p);

                // }
                //       }

             //   Operario pe = new Operario();
             //   pe.setIdoperario(operario);


                //List<Operario> operarios = new ArrayList<Operario>();
                //operarios = e.buscarPersona();
                //for (Iterator<Operario> it = operarios.iterator(); it.hasNext();) {
                //   Operario operario = it.next();
                c.setOperario(operar);
                // }


                c.setTotalRacimosVarietal(Integer.parseInt(totalRacimosV));

                c.setTotalRacimosNoVarietal(Integer.parseInt(totalRacimosNV));
                // System.out.println(cantVarietal + cantNoVarietal);
                c.setRacimosTomados(Integer.parseInt(totalRacimosV + totalRacimosNV));
                //racimosTomados.setText(Integer.toString(cantVarietal + cantNoVarietal));
                c.setRacimosSegundaFlor(Float.parseFloat(racimosSegunda.getSelectedItem().toString()));
                c.setGraduacion(Float.parseFloat(grad));
                c.setAzucar(Float.parseFloat(azucar));
                c.setNetoRacimosTomados(Float.parseFloat(netoRTomados));
                c.setBrutoRacimosTomados(Float.parseFloat(brutoRTomados));
                c.setPesoMedioRacimoTomado(Float.parseFloat(pesoMRacimos));
                c.setTaraRacimosTomados(Float.parseFloat(netoRTomados) + Float.parseFloat(brutoRTomados));
                // c1 = e.guardar(c);
                // List<Transporte> t = new ArrayList<Transporte>();
                // t = e.buscarTransportes();
                //  Detallerecepcion dr= new Detallerecepcion();
                //  dr= EsperaCalidad.det;
                detSeleccionado.setCondicion(c);

                Estadoespera ee;
                Estadoespera ese = new Estadoespera();
                ese = e.buscarEstadoEspera("PesoEntradaPendiente");

                // for (Iterator<Estadoespera> it = ese.iterator(); it.hasNext();) {
                //  Estadoespera estadoespera = it.next();

                detSeleccionado.setEstadoespera(ese);


                // }
                ciu.setOperario(operar);
                ciu.setFechaHoraCIU(new Date());
                ciu.setObservaciones(observaciones.getText());
                ciu.setModalidadComercializacion("");
                // ciu.setNumeroCIU(0)
                //      c.setCiu(ciu);
                try {
                    ep.guardarCiu(ciu);
                    ep.guardarCondicion(c);
                    ep.actualizarDetalleRecepcion(detSeleccionado);



                    //        while (it.hasNext()) {
                    //            t = (Transporte) it.next();
                    //            if (t.getPatenteTransporte().equalsIgnoreCase(EsperaCalidad.patente))
                    //            {
                    //                System.out.println(EsperaCalidad.patente);
                    //                t.setEstadoTransporte("PesoEntradaPendiente");
                    //                e.actualizarTransporte(t);
                    //        }
                    //        }
                } catch (NonexistentEntityException ex) {
                    Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
                } catch (Exception ex) {
                    Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
                }
                JOptionPane.showMessageDialog(this, "Control de Calidad Almacenado", "Alta", JOptionPane.INFORMATION_MESSAGE);
                this.setVisible(false);
                //  EsperaCalidad esp = new EsperaCalidad();
                //    esp.setVisible(true);
                //   refresh();
            }
            EsperaCalidad esp = new EsperaCalidad(operar.getApellido());
                esp.setVisible(true);
              // refresh();

        }
    }
//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
   EsperaCalidad ec = null;
        try {
            ec = new EsperaCalidad(operar.getApellido()); // TODO add your handling code here:
        } catch (Exception ex) {
            Logger.getLogger(ControlCalidad.class.getName()).log(Level.SEVERE, null, ex);
        }
   ec.setVisible(true);
   this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed

private void numeroRemitoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numeroRemitoActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_numeroRemitoActionPerformed

private void numeroRecepcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numeroRecepcionActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_numeroRecepcionActionPerformed
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                ControlCalidad alta = new ControlCalidad(operario);
                alta.setLocationRelativeTo(null);
                alta.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField botrytis;
    private javax.swing.JTextField bruto;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.ButtonGroup buttonGroup4;
    private javax.swing.JTextField clasificacion;
    private javax.swing.JTextField graduac;
    private javax.swing.JTextField granizo;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JRadioButton jRadioButton8;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextFieldUsuario;
    private java.awt.Label label1;
    private java.awt.Label label10;
    private java.awt.Label label11;
    private java.awt.Label label12;
    private java.awt.Label label19;
    private java.awt.Label label2;
    private java.awt.Label label20;
    private java.awt.Label label21;
    private java.awt.Label label22;
    private java.awt.Label label3;
    private java.awt.Label label5;
    private java.awt.Label label6;
    private java.awt.Label label7;
    private java.awt.Label label8;
    private java.awt.Label label9;
    private javax.swing.JComboBox limpieza;
    private javax.swing.JTextField neto;
    private javax.swing.JTextField noVarietal;
    private javax.swing.JTextField numeroContrato;
    private javax.swing.JTextField numeroRecepcion;
    private javax.swing.JTextField numeroRemito;
    private javax.swing.JTextArea observaciones;
    private javax.swing.JTextField oidio;
    private javax.swing.JTextField patente;
    private javax.swing.JTextField peronospera;
    private javax.swing.JTextField pesoMedio;
    private javax.swing.JComboBox presenciaHojas;
    private javax.swing.JComboBox racimosSegunda;
    private javax.swing.JComboBox temperatura;
    private javax.swing.JTextField tenorA;
    private javax.swing.JTextField varietal;
    // End of variables declaration//GEN-END:variables
    private boolean validarDatos(String azucar, String netoRTomados, String brutoRTomados, String pesoMRacimos, String peronospora, String botryt, String oidi, String graniz, String totalRacimosV, String totalRacimosNV, String grad) {

        boolean ver = false;
        if (peronospora.equals("")) {
            peronospora = "0";
        }
        if (botryt.equals("")) {
            botryt = "0";
        }
        if (oidi.equals("")) {
            oidi = "0";
        }
        if (graniz.equals("")) {
            graniz = "0";
        }
        if (azucar.equals("") || netoRTomados.equals("") || brutoRTomados.equals("") || pesoMRacimos.equals("") || totalRacimosV.equals("") || totalRacimosNV.equals("") || grad.equals("")) {
            JOptionPane.showMessageDialog(this, "Complete todos los campos", "Error", JOptionPane.ERROR_MESSAGE);
        } else if (!Validador.getInstance().esFloat(azucar)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Azucar", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(netoRTomados)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Neto", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(brutoRTomados)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Bruto", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(pesoMRacimos)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Peso Medio", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(peronospora)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Peronóspora", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(botryt)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Botrytis", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(graniz)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Granizo", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(oidi)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Granizo", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esInteger(totalRacimosV)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un entero en el campo Cantidad Varietal", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esInteger(totalRacimosNV)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un entero en el campo Cantidad No Varietal", "Error", JOptionPane.ERROR_MESSAGE);

        } else if (!Validador.getInstance().esFloat(grad)) {
            JOptionPane.showMessageDialog(this, "Debe Ingresar un real en el campo Graduación", "Error", JOptionPane.ERROR_MESSAGE);

        } else {
            ver = true;
        }
        return ver;
    }
}
